﻿using umbraco.BusinessLogic;
using umbraco.cms.businesslogic;
using umbraco.cms.businesslogic.web;

namespace umbraco.DataServices.Linq
{
    /// <summary>
    /// Used as a notifier when a document type has been created/modified/deleted
    /// </summary>
    public sealed class UmbracoDocumentTypeManager : ApplicationBase  {

        public UmbracoDocumentTypeManager() {
            DocumentType.AfterSave += (DocumentType_AfterSave);
            DocumentType.AfterDelete += (DocumentType_AfterDelete);
        }

        private static void DocumentType_AfterDelete(DocumentType sender, DeleteEventArgs e) {
            UmbracoContextFactory.Instance.Refresh();
        }

        private static void DocumentType_AfterSave(DocumentType sender, SaveEventArgs e) {
            UmbracoContextFactory.Instance.Refresh();
        }

    }
}
